<template>
  <div class="bookBox">
    <div v-if="!isShowyangshi" class="qwe">
      <div
        @click="$router.push({ path: '/bookdetails', query: { id: item.id } })"
        :class="isShow ? 'bookIntroduce cursor' : 'SbookIntroduce cursor'"
        v-for="item in booksList"
        :key="item.id"
      >
        <img :src="item.photo" alt="" />
        <div class="bookDetails">
          <div class="bookname">{{ item.book_name }}</div>
          <div class="author">{{ item.author_name }}</div>
          <div class="details">
            {{ item.summary }}
          </div>
          <div class="time">{{ item.update_time }}</div>
        </div>
      </div>
    </div>

    <div
      v-if="isShowyangshi"
      @click="
        $router.push({ path: '/bookdetails', query: { id: booksList.id } })
      "
      :class="isShow ? 'bookIntroduce cursor' : 'bookIntroduce cursor'"
    >
      <img :src="booksList.photo" alt="" />
      <div class="bookDetails">
        <div class="bookname">{{ booksList.book_name }}</div>
        <div class="author">{{ booksList.author_name }}</div>
        <div class="details">
          {{ booksList.summary }}
        </div>
        <div class="time">{{ booksList.update_time }}</div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  // isShow  bookIntroduce是rankings 样式  SbookIntroduce是书籍目录猜你喜欢样式
  props: ["isShow", "booksList", "isShowyangshi"],
  data() {
    return {};
  },
  created() {
    console.log(this.booksList, "booksList");
  },
};
</script>
 
<style lang = "less" scoped>
.qwe{
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
}
.bookBox {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
}
.bookIntroduce {
  display: flex;
  margin-bottom: 40px;
  img {
    width: 133px;
    height: 179px;
    border-radius: 4px;
  }
  .bookDetails {
    margin-left: 20px;
    width: 200px;
    position: relative;
    .bookname {
      font-size: 18px;
      font-weight: 500;
      color: #333333;
    }
    .author {
      margin: 9px 0 18px;
      font-size: 12px;
      color: #999999;
    }
    .details {
      height: 90px;
      line-height: 21px;
      font-size: 12px;
      color: #666666;
      opacity: 0.8;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .time {
      position: absolute;
      left: 0;
      bottom: 0;
      font-size: 12px;
      color: #999999;
    }
  }
}
.SbookIntroduce {
  display: flex;
  margin-bottom: 28px;
  img {
    width: 100px;
    height: 134px;
  }
  .bookDetails {
    margin-left: 15px;
    .bookname {
      font-size: 14px;
      font-weight: 500;
      color: #333333;
    }
    .author {
      font-size: 12px;
      color: #999999;
      margin: 6px 0 18px;
    }
    .details {
      height: 56px;
      line-height: 18px;
      font-size: 12px;
      color: #666666;
      opacity: 0.8;
      display: -webkit-box;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 3;
      overflow: hidden;
    }
    .time {
      font-size: 12px;
      color: #999999;
      margin-top: 20px;
    }
  }
}
</style>